package com.gzyj.web.service;

import com.gzyj.data.web.cljk.PointLatLng;
import org.springframework.stereotype.Service;

@Service
public class BaiduMapFixService {
    private static final double x_pi = 3.14159265358979324 * 3000.0 / 180.0;
    public PointLatLng bd_encrypt(double gg_lat, double gg_lon) {
        double bd_lat;
        double bd_lon;
        double x = gg_lon, y = gg_lat;
        double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
        double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
        bd_lon = z * Math.cos(theta) + 0.0065;
        bd_lat = z * Math.sin(theta) + 0.006;

        return new PointLatLng(bd_lon, bd_lat);
    }

}
